package org.example.controller;

import cn.hutool.json.JSONUtil;
import org.springframework.security.core.context.SecurityContextHolder;;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 */
@RestController
public class ResController {

    @GetMapping("/api/res")
    @ResponseBody
    public String getResource() {
        Object obj = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return JSONUtil.toJsonStr(obj);
    }
}
